package com.xinqi.common.mybatis.data.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * mybatis 基础服务
 *
 * @author linkai
 * @since 2018/9/1
 */
public interface BaseService<T> extends IService<T> {

    boolean delete(Collection<? extends Serializable> idx);

    boolean deleteById(Serializable ids);

    boolean deletedByIds(List<Long> ids);

    boolean updateAllColumnById(T entity);

    @Transactional(rollbackFor = Exception.class)
    boolean updateBatchAllColumnById(Collection<T> entityList, int batchSize);

    /**
     * 根据 ID 查询数据, 无视逻辑删除字段
     *
     * @param id 主键ID
     */
    T selectByIdWithDeleted(Serializable id);

}
